package com.dragon.modules.yuegou.service.impl.message;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dragon.modules.yuegou.entity.message.PushEntity;
import com.dragon.modules.yuegou.enums.message.PushStatus;
import com.dragon.modules.yuegou.mapper.message.PushMapper;
import com.dragon.modules.yuegou.model.message.Push;
import com.dragon.modules.yuegou.service.message.PushService;
import com.dragon.modules.yuegou.web.Check;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
/**
 * 消息推送 服务实现
 *
 * @author pbuilder generated
 * @date 2019-03-18 13:46:09
 * @version 2.0
 */
@Service("msgPushService")
public class PushServiceImpl
		extends ServiceImpl<PushMapper, PushEntity>
		implements PushService {

	@Override
	public void savePush(Push push){
		Check.notEmpty(push.getBusdId(),"请选择商圈");
		Check.notEmpty(push.getTitle(),"推送名称不能为空");
		Check.notEmpty(push.getTemplateId(),"模板不能为空");
		Check.notEmpty(push.getArgValues(),"推送内容不能为空");
		if(StringUtils.isEmpty(push.getId())){
			push.setSupportSms(false);
			push.setSupportEmail(false);
			push.setSupportJpush(false);
			push.setSupportWechat(false);
			push.setStatus(PushStatus.PUSHED);
			push.setDel(false);
			save(push);
		}
	}

}